home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 43.zip / Lattice Compiler disk 1.adf / execute.c < prev    next >
C/C++ Source or Header  |  1988-09-18  |  1KB  |  69 lines

  1. #include "stdio.h"
  2. #include "fcntl.h"
  3. #include "exec/types.h"
  4. #include "exec/nodes.h"
  5. #include "exec/lists.h"
  6. #include "exec/libraries.h"
  7. #include "exec/ports.h"
  8. #include "exec/interrupts.h"
  9. #include "exec/io.h"
  10. #include "exec/memory.h"
  11. #include "libraries/dos.h"
  12. #include "libraries/dosextens.h"
  13.  
  14. #define BUFF_SIZE 1
  15.  
  16. extern struct FileHandle *Open();
  17.  
  18. main()
  19. {
  20. char string[255];
  21. int a;
  22.  
  23. while (5<6){
  24. a=getstring(string);
  25. printf("%s",string);
  26. execute(string);
  27. }
  28. }
  29.  
  30. getstring(string)
  31. char *string;
  32. {
  33.  
  34. int  count,file,lengte,status;
  35. char *buffer,letter[1];
  36.  
  37. count = 0;
  38. lengte = 1;
  39. status = 0;
  40. buffer = letter;
  41. file = open("ser:",O_RDONLY);
  42. if (file != -1){
  43. status = read(file,buffer,lengte);
  44. while (*buffer != '\n'){
  45. string[count] = *buffer;
  46. status = read(file,buffer,lengte);
  47. count ++;
  48. }
  49. string[count] = '\0';
  50. count = 0;
  51. status = close(file);
  52. return(status);
  53. }
  54. return(file);
  55. }
  56.  
  57. execute(string)
  58. char *string;
  59.  
  60. {
  61. struct FileHandle *serial;
  62. int Success;
  63.  
  64. serial=Open("SER:",MODE_OLDFILE);
  65. Success=Execute(string,0,serial);
  66. Close(serial);
  67. return(Success);
  68. }
  69.